{include file="buy/header.tpl"}
{literal}
<style>
.table th{background:#f5f5f5;}
.table td{text-align:left;}

.suoding{height:30px;}
.imgbox{width:220px;height:300px;padding:2px;float:left;text-align:center;line-height:20px;border:1px #ccc solid;margin-left:10px;margin-top:10px;}
.imgbox:hover{border:1px #f40 solid;}
.price{color: #f40;font-weight: 700;font-family: verdana,arial;}
</style>
{/literal}
<body id="">
	<link href="./static/public/jsorder/css/order.css" rel="stylesheet" />


<!-- 头部// -->


	<!-- start: Content -->
			<div id="content" class="" style="padding:0px;top:0px;">
			
						
			<div class="row-fluid">


<div class="box" style="maring-left:50px;">
<table class="table  table-bordered table-hover " style="text-align:center;position: fixed;top: 0px;">
<tr>
<th colspan="5">
今日推荐
</th>
</tr>
</table>

<div class="box" style="padding-top:50px;">

{foreach from=$goods item=l name=g}

<div class="imgbox">
<a href="javascript:mx('{$l.sku}')">
 {if $l.image==""}
 <img src="./static/attached/face/noimage.jpg">
 {else}
 <img src="{$l.image}">{/if}</a>

<span class="price">¥{$l.price}</span><br>
{if $user.manager==1}
<a href="javascript:edit({$l.id})"><i class="icon-edit"></i></a>
{/if}
<a href="javascript:mx('{$l.sku}')">{$l.goods_name}</a>
{if $l.sku>0}
<a href="javascript:upload({$l.sku})" title="上传实拍图"><i class="icon-upload"></i></a>
{/if}
<br>
<div  id="cart{$l.id}">
{if $l.buy==1}
<a href="javascript:void(0)" class="label label-important">已经添加</a>
{else}
<a href="javascript:addCart({$l.id})" id="{$l.id}" jsordername="{$l.goods_name}" price="{$l.price*$l.num}"  class="btn btn-warning jsorderadd">加入购物车</a></td>
{/if}
</div>
</div>
{/foreach}
</div>
</div>
<div style="display:none">
<form action="/index.php?order/confirm" method="post" id="form">
<input  type="text" name="goodsinfo" id="goodsinfo">
</form>
</div>
</body>
</html>
<script type="text/javascript" src="./static/public/jsorder/js/cookie.js"></script>
<script type="text/javascript" src="./static/public/jsorder/js/jsorder.js"></script>
 <script  type="text/javascript" src="./static/public/layer/layer.min.js" ></script>
{literal}
<script type="text/javascript">
function mx(sku){
	$.layer({
	    type: 2,
	    shadeClose: true,
	    title: false,
	    closeBtn: [0, true],
	    shade: [0.3, '#000'],
	    border: [0],
	    offset: ['20px',''],
	    area: ['850px', ($(window).height() - 50) +'px'],
	    iframe: {src: './index.php?buy/mx/?sku='+sku,
	        scrolling: 'yes'
	      }
	}) 

}

function upload(sku){	
	$.layer({
	    type: 2,
	    shadeClose: true,
	    title: false,
	    closeBtn: [0, true],
	    shade: [0.3, '#000'],
	    border: [0],
	    offset: ['20px',''],
	    area: ['850px', ($(window).height() - 50) +'px'],
	    iframe: {src: './index.php?buy/upload/?sku='+sku,
	        scrolling: 'yes'
	      }
	}) 

}

function edit(id){
	$.layer({
	    type: 2,
	    shadeClose: true,
	    title: false,
	    closeBtn: [0, true],
	    shade: [0.3, '#000'],
	    border: [0],
	    offset: ['20px',''],
	    area: ['850px', ($(window).height() - 50) +'px'],
	    iframe: {src: './index.php?buy/edit/?id='+id,
	        scrolling: 'no'
	      }
	}) 

}

function addCart(id){

	var h="<a href='javascript:void(0)' class='label label-important'>已经添加</a>";
	$("#cart"+id).html(h);
}

//jsorder配置
$.fn.jsorder.defaults = {
	staticname : 'jsorder',
	jsorderclass : 'jsorder',
	savecookie : true,
	cookiename : 'buy',
	numpre : 'no_',
	jsorderpre : 'jsorder_',
	jsorderspanpre : 'jsorderspan_',
	pricefiled : 'price',
	namefiled : 'jsordername',
	leftdemo : '购物车',
	subbuttom : 'cart', 
	//addbuttom : 'a.jsorderadd', 
	addbuttom : 'a.jsorderadd', 
	nomessage : '你今天的包裹是还空的',
	dosubmit : function(data) {
$("#goodsinfo").val(JSON.stringify(data));
$("#form").submit();
}
};
$("body").jsorder();</script>
{/literal}

